package com.example.xianglilai_end.Controller;

import com.example.xianglilai_end.Bean.Cgstation;
import com.example.xianglilai_end.Bean.ChangeData;
import com.example.xianglilai_end.Bean.ServiceStation;
import com.example.xianglilai_end.Service.BatteriesService;
import com.example.xianglilai_end.Service.StationsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StationsController {
    @Autowired
    StationsService stationsService;  // 自动注入BatteriesService

    @CrossOrigin
    @GetMapping("api/cgstation/getInfo")
    /* 获取换电站信息 */
    public List<Cgstation> getCgstationInfo(){
        return stationsService.getCgstationInfo();
    }

    @CrossOrigin
    @GetMapping("api/service/getInfo")
    /* 获取换电站信息 */
    public List<ServiceStation> getServiceInfo(){
        return stationsService.getServiceInfo();
    }

    @CrossOrigin
    @GetMapping("api/cgstation/changeData")
    /* 获取换电信息 */
    public List<ChangeData> getChangeData() { return stationsService.getChangeData(); }

    @CrossOrigin
    @GetMapping("api/userNum")
    public int getUserNum(){
        return stationsService.getUserNum();
    }
}

